<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of MoviesController
 *
 * @author Zelic
 */
class App_Admin_Controller_Movies extends Lib_Controller {

    function index() {
        $this->data['movies'] = $this->model->select('all');
    }
    
    function detail($data){
        if ($data!=null){
            $this->data['movies'] = $this->model->select(array("where"=>"id=".$data[0]));
        }
    }

    function insert($data = null) {
        if (is_array($data)&&!empty($data)) {
            $image = Lib_Helper_Uploader::upload('image');
            if ($image != false) {
                $data['image'] = $image;
                $this->model->insert($data);
                $this->redirect('admin/movies/index');
            }
        }        
    }

    function update($data) {
        if (is_array($data)) {
            $this->model->update($data);
        }
    }

    function delete() {
        
    }

}

?>
